﻿using MyTest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class OOP : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Product p=new Product();   //抽象类是不能够实例化的
        try
        {
            Book2 book = new Book2();
            book.Name = "天龙八部";
            book.Price = 38.0M;
            // book.Isbn = "1234567890123";//ISBN为13位
            book.Isbn = "12345678901230";//错误的ISBN
            book.Intro = "金庸小说";
            Response.Write(book.Show() + "<br>");
            Response.Write(book.ShowDetail() + "<br>");
            Digital digital = new Digital();
            digital.Name = "音箱";
            digital.Price = 399M;
            digital.Barcode = "11234343430";

            MyTest.Action buy = new MyTest.Action();
            
            
            Response.Write(buy.Add(book));
            Response.Write(buy.Buy(digital));
            Response.Write(buy.Show());
            


        }
        catch (ArgumentException arg_e)
        {
            Response.Write(arg_e.Message);
        }
        catch(Exception)
        {
            Response.Write("其它异常");
        }
        finally
        {
            Response.Write("一定会执行的，通常用于清理、数据库连接...");
        }
       

    }
}